package com.project_task.mapper;

import com.github.pagehelper.Page;
import com.project_task.annotation.AutoFill;
import com.project_task.dto.ProjectPageQueryDTO;
import com.project_task.entity.Project;
import com.project_task.enumeration.OperationType;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface ProjectMapper {

    /**
     * 创建项目
     * @param project
     */
    @Insert("insert into project (name, description, create_time, update_time, is_deleted) " +
            "values (#{name}, #{description}, #{createTime}, #{updateTime}, 0)")
    @AutoFill(value = OperationType.INSERT)
    void save(Project project);

    /**
     * 分页查询
     * @param projectPageQueryDTO
     * @return
     */
    Page<Project> pageQuery(ProjectPageQueryDTO projectPageQueryDTO);
}
